<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>我是div</div>
    <span>我是span</span>
    <ul>
        <li>我是li</li>
        <li>我是li</li>
        <li>我是li</li>
        <li>我是li</li>
    </ul>
    <div class="box">
        <span class="erweima">×</span>
    </div>
    <script>
        //父节点
        var erweima = document.querySelector('.erweima');
        // var box = document.querySelector('.box');
        erweima.parentNode;
        console.log(erweima.parentNode);
        //指定元素找不到父节点,返回为null
        var ul = document.querySelector('ul');
        ul.childNodes;
        console.log(ul.childNodes);
        console.log(ul.childNodes[0].nodeType);
        console.log(ul.childNodes[1].nodeType);
        for(var i = 0; i < ul.childNodes.length; i++){
            if(ul.childNodes[i].nodeType == 1){
                console.log(ul.childNodes[i]);
            }
        }
        //children获取所有的子元素节点，实际开发使用
        console.log(ul.children);
    </script>
</body>
</html>